package com.atguigu.eduservice.controller;

import com.atguigu.commonutils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

/**
 * 后台 banner 接口
 *
 * @author: He Wentao
 * @date: 2022/8/17 15:11
 */
@Api(tags = {"用户登录"})
@RestController
@RequestMapping("eduservice/user")
@CrossOrigin  // 解决跨域问题
public class EduLoginController {


    @ApiOperation("login登录接口")
    @PostMapping("/login")
    public R login(@RequestParam("username") String username, @RequestParam("password") String password) {
        // 模拟获取到 token
        return R.ok().data("token","admin");
    }

    @ApiOperation("info 获取用户信息接口")
    @GetMapping("/info")
    public  R  info(@RequestParam("token") String token){
        // 模拟返回用户信息
        return R.ok().data("name","张三").data("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
    }

}
